<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: install_step_4.php 136 2013-09-22 07:38:55Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 136 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-22 07:38:55 +0000 (Sun, 22 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

if(!defined('VALID_INSTALLER')) {
	header('Location: ../../'); exit;
}
$db = new mercari_db();

$configuration = $db->db_query("SELECT configuration_key, configuration_value FROM ".TABLE_CONFIGURATION);
while(!$configuration->EOF) {
	define($configuration->fields['configuration_key'], $configuration->fields['configuration_value']);
	$configuration->MoveNext();
}

$message_stack = new message_stack();
$process = false;
if (isset($_GET['action']) && ($_GET['action'] == 'process')) {
    $process = true;
    
    $status_discount = $_POST['STATUS_DISCOUNT'];
    $status_ot_discount_flag = $_POST['STATUS_OT_DISCOUNT_FLAG'];
    $status_ot_discount = $_POST['STATUS_OT_DISCOUNT'];
    $graduated_price = $_POST['STATUS_GRADUATED_PRICE'];
    $show_price = $_POST['STATUS_SHOW_PRICE'];
    $show_tax = $_POST['STATUS_SHOW_TAX'];

    $status_discount2 = $_POST['STATUS_DISCOUNT2'];
    $status_ot_discount_flag2 = $_POST['STATUS_OT_DISCOUNT_FLAG2'];
    $status_ot_discount2 = $_POST['STATUS_OT_DISCOUNT2'];
    $graduated_price2 = $_POST['STATUS_GRADUATED_PRICE2'];
    $show_price2 = $_POST['STATUS_SHOW_PRICE2'];
    $show_tax2 = $_POST['STATUS_SHOW_TAX2'];

    $status_discount3 = $_POST['STATUS_DISCOUNT3'];
    $status_ot_discount_flag3 = $_POST['STATUS_OT_DISCOUNT_FLAG3'];
    $status_ot_discount3 = $_POST['STATUS_OT_DISCOUNT3'];
    $graduated_price3 = $_POST['STATUS_GRADUATED_PRICE3'];
    $show_price3 = $_POST['STATUS_SHOW_PRICE3'];
    $show_tax3 = $_POST['STATUS_SHOW_TAX3'];

    $error = false;
    // Standard fuer Gaeste
	if (strlen($status_discount) < '3') {
		$error = true;
		$message_stack->add('install_step4', ENTRY_DISCOUNT_ERROR);
	}
	if (strlen($status_ot_discount) < '3') {
		$error = true;
		$message_stack->add('install_step4', ENTRY_OT_DISCOUNT_ERROR);
	}
	if ( ($status_ot_discount_flag != '1') && ($status_ot_discount_flag != '0') ) {
		$error = true;
		$message_stack->add('install_step4', SELECT_OT_DISCOUNT_ERROR);
	}
	if ( ($graduated_price != '1') && ($graduated_price != '0') ) {
		$error = true;
		$message_stack->add('install_step4', SELECT_GRADUATED_ERROR);
	}
	if ( ($show_price != '1') && ($show_price != '0') ) {
		$error = true;
		$message_stack->add('install_step4', SELECT_PRICE_ERROR);
	}
	if ( ($show_tax != '1') && ($show_tax != '0') ) {
		$error = true;
		$message_stack->add('install_step4', SELECT_TAX_ERROR);
	}

	// Standard fuer "Neuer Kunde"
	if (strlen($status_discount2) < '3') {
		$error = true;
		$message_stack->add('install_step4', ENTRY_DISCOUNT_ERROR2);
	}
	if (strlen($status_ot_discount2) < '3') {
		$error = true;
		$message_stack->add('install_step4', ENTRY_OT_DISCOUNT_ERROR2);
	}
	if ( ($status_ot_discount_flag2 != '1') && ($status_ot_discount_flag2 != '0') ) {
		$error = true;
		$message_stack->add('install_step4', SELECT_OT_DISCOUNT_ERROR2);
	}
	if ( ($graduated_price2 != '1') && ($graduated_price2 != '0') ) {
		$error = true;
		$message_stack->add('install_step4', SELECT_GRADUATED_ERROR2);
	}
	if ( ($show_price2 != '1') && ($show_price2 != '0') ) {
		$error = true;
		$message_stack->add('install_step4', SELECT_PRICE_ERROR2);
	}
	if ( ($show_tax2 != '1') && ($show_tax2 != '0') ) {
		$error = true;
		$message_stack->add('install_step4', SELECT_TAX_ERROR2);
	}

	// Standard fuer "Haendler"
	if (strlen($status_discount2) < '3') {
		$error = true;
		$message_stack->add('install_step4', ENTRY_DISCOUNT_ERROR2);
	}
	if (strlen($status_ot_discount2) < '3') {
		$error = true;
		$message_stack->add('install_step4', ENTRY_OT_DISCOUNT_ERROR2);
	}
	if ( ($status_ot_discount_flag2 != '1') && ($status_ot_discount_flag2 != '0') ) {
		$error = true;
		$message_stack->add('install_step4', SELECT_OT_DISCOUNT_ERROR2);
	}
	if ( ($graduated_price2 != '1') && ($graduated_price2 != '0') ) {
		$error = true;
		$message_stack->add('install_step4', SELECT_GRADUATED_ERROR2);
	}
	if ( ($show_price2 != '1') && ($show_price2 != '0') ) {
		$error = true;
		$message_stack->add('install_step4', SELECT_PRICE_ERROR2);
	}
	if ( ($show_tax2 != '1') && ($show_tax2 != '0') ) {
		$error = true;
		$message_stack->add('install_step4', SELECT_TAX_ERROR2);
	}
	if ($error == false) {

		// admin
		$db->db_query("INSERT INTO ".DB_PREFIX."customers_status (customers_status_id, language_id, customers_status_name, customers_status_public, customers_status_image, customers_status_discount, customers_status_ot_discount_flag, customers_status_ot_discount, customers_status_graduated_prices, customers_status_show_price, customers_status_show_price_tax) VALUES ('0', '1', 'Admin', 1, 'admin_status.gif', '0.00', '1', '0.00', '1', '1', '1')");

		// Standard fuer Gaeste
		$db->db_query("INSERT INTO ".DB_PREFIX."customers_status (customers_status_id, language_id, customers_status_name, customers_status_public, customers_status_image, customers_status_discount, customers_status_ot_discount_flag, customers_status_ot_discount, customers_status_graduated_prices, customers_status_show_price, customers_status_show_price_tax) VALUES (1, 1, 'Gast', 1, 'guest_status.gif', '".$status_discount."', '".$status_ot_discount_flag."', '".$status_ot_discount."', '".$graduated_price."', '".$show_price."', '".$show_tax."')");

		// Standard fuer "Neuer Kunde"
		$db->db_query("INSERT INTO ".DB_PREFIX."customers_status (customers_status_id, language_id, customers_status_name, customers_status_public, customers_status_image, customers_status_discount, customers_status_ot_discount_flag, customers_status_ot_discount, customers_status_graduated_prices, customers_status_show_price, customers_status_show_price_tax) VALUES (2, 1, 'Neuer Kunde', 1, 'customer_status.gif', '".$status_discount2."', '".$status_ot_discount_flag2."', '".$status_ot_discount2."', '".$graduated_price2."', '".$show_price2."', '".$show_tax2."')");

		// Standard fuer "Haendler"
		$db->db_query("INSERT INTO ".DB_PREFIX."customers_status (customers_status_id, language_id, customers_status_name, customers_status_public, customers_status_image, customers_status_discount, customers_status_ot_discount_flag, customers_status_ot_discount, customers_status_graduated_prices, customers_status_show_price, customers_status_show_price_tax) VALUES (3, 1, 'H&auml;ndler', 1, 'merchant_status.gif', '".$status_discount3."', '".$status_ot_discount_flag3."', '".$status_ot_discount3."', '".$graduated_price3."', '".$show_price3."', '".$show_tax3."')");

		redirect('index.php?step=finished');
	}
}
include('includes/metatag.php');
?>
<title>SEO:mercari Installation - Schritt 4</title>
</head>
<body>
<script type="text/javascript" src="includes/javascript/tooltip.js" encode="UTF-8" ></script>
<script type="text/javascript">$(function(){$('#customers_group').submit()})</script>
<?php include('includes/header.php'); ?>
<div id="wrapper">
	<div id="inner_wrapper">
		<table class="outerTable" width="100%" cellpadding="4">
			<tr>
				<td class="columnRight" valign="top">
					<table class="table_pageHeading" border="0" width="100%" cellspacing="0" cellpadding="0">
						<tr>
							<td class="pageHeading">
								<h1 class="schatten">Schritt 4</h1>
							</td>
						</tr>
					</table>
					<form id="customers_group" name="install" action="index.php?step=4&action=process" method="post">
						<p><?php echo TEXT_WELCOME_STEP7; ?></p>
	
						<h2 class="schatten">
							<?php echo TITLE_GUEST_CONFIG; ?>
							<?php echo ' <span'.mouseOverJS('',TITLE_GUEST_CONFIG_NOTE,'','200').'>
								<img src="images/icons/information-balloon.png" alt="" />
							</span>'; ?>
						</h2>
						<table cellpadding="8" cellspacing="8" class="table_input" width="100%">
							<tr>
								<td valign="middle" width="150">
								    <b><?php echo TEXT_STATUS_DISCOUNT; ?></b>
								</td>
								<td valign="middle">
									<?php echo draw_input_field_installer('STATUS_DISCOUNT','0.00');?>
									<?php echo ' <span'.mouseOverJS('',TEXT_STATUS_DISCOUNT_LONG).'>
									<img src="images/icons/information-balloon.png" alt="" />
									</span>'; ?>
								</td>
							</tr>
						</table>
						<table cellpadding="8" cellspacing="8" class="table_input" width="100%">
							<tr>
								<td valign="middle" width="150">
								    <b><?php echo TEXT_STATUS_OT_DISCOUNT_FLAG; ?></b>
								</td>
								<td valign="middle">
									<?php echo  TEXT_ZONE_YES .' '. draw_radio_field_installer('STATUS_OT_DISCOUNT_FLAG', '1');?>
									<?php echo  TEXT_ZONE_NO .' '. draw_radio_field_installer('STATUS_OT_DISCOUNT_FLAG', '0', 'true'); ?>
									<?php echo ' <span'.mouseOverJS('',TEXT_STATUS_OT_DISCOUNT_FLAG_LONG).'>
									<img src="images/icons/information-balloon.png" alt="" />
									</span>'; ?>
								</td>
							</tr>
						</table>
						<table cellpadding="8" cellspacing="8" class="table_input" width="100%">
							<tr>
								<td valign="middle" width="150">
								    <b><?php echo TEXT_STATUS_OT_DISCOUNT; ?></b>
								</td>
								<td valign="middle">
									<?php echo draw_input_field_installer('STATUS_OT_DISCOUNT','0.00');?>
									<?php echo ' <span'.mouseOverJS('',TEXT_STATUS_OT_DISCOUNT_LONG).'>
									<img src="images/icons/information-balloon.png" alt="" />
									</span>'; ?>
								</td>
							</tr>
						</table>
						<table cellpadding="8" cellspacing="8" class="table_input" width="100%">
							<tr>
								<td valign="middle" width="150">
								    <b><?php echo TEXT_STATUS_GRADUATED_PRICE; ?></b>
								</td>
								<td valign="middle">
									<?php echo  TEXT_ZONE_YES.' '. draw_radio_field_installer('STATUS_GRADUATED_PRICE', '1');?>
									<?php echo  TEXT_ZONE_NO .' '. draw_radio_field_installer('STATUS_GRADUATED_PRICE', '0', 'true'); ?>
									<?php echo ' <span'.mouseOverJS('',TEXT_STATUS_GRADUATED_PRICE_LONG).'>
									<img src="images/icons/information-balloon.png" alt="" />
									</span>'; ?>
								</td>
							</tr>
						</table>
						<table cellpadding="8" cellspacing="8" class="table_input" width="100%">
							<tr>
								<td valign="middle" width="150">
								    <b><?php echo TEXT_STATUS_SHOW_PRICE; ?></b>
								</td>
								<td valign="middle">
									<?php echo  TEXT_ZONE_YES.' '. draw_radio_field_installer('STATUS_SHOW_PRICE', '1', 'true'); ?>
									<?php echo  TEXT_ZONE_NO .' '. draw_radio_field_installer('STATUS_SHOW_PRICE', '0'); ?>
									<?php echo ' <span'.mouseOverJS('',TEXT_STATUS_SHOW_PRICE_LONG).'>
									<img src="images/icons/information-balloon.png" alt="" />
									</span>'; ?>
								</td>
							</tr>
						</table>
						<table cellpadding="8" cellspacing="8" class="table_input" width="100%">
							<tr>
								<td valign="middle" width="150">
								    <b><?php echo TEXT_STATUS_SHOW_TAX; ?></b>
								</td>
								<td valign="middle">
									<?php echo  TEXT_ZONE_YES.' '. draw_radio_field_installer('STATUS_SHOW_TAX', '1', 'true'); ?>
	                      			<?php echo  TEXT_ZONE_NO .' '. draw_radio_field_installer('STATUS_SHOW_TAX', '0'); ?>
									<?php echo ' <span'.mouseOverJS('',TEXT_STATUS_SHOW_TAX_LONG).'>
									<img src="images/icons/information-balloon.png" alt="" />
									</span>'; ?>
								</td>
							</tr>
						</table>
	
						<h2 class="schatten">
							<?php echo TITLE_CUSTOMERS_CONFIG; ?>
							<?php echo ' <span'.mouseOverJS('',TITLE_CUSTOMERS_CONFIG_NOTE,'','200').'>
								<img src="images/icons/information-balloon.png" alt="" />
							</span>'; ?>
						</h2>
						<table cellpadding="8" cellspacing="8" class="table_input" width="100%">
							<tr>
								<td valign="middle" width="150">
								    <b><?php echo TEXT_STATUS_DISCOUNT; ?></b>
								</td>
								<td valign="middle">
									<?php echo draw_input_field_installer('STATUS_DISCOUNT2','0.00');?>
									<?php echo ' <span'.mouseOverJS('',TEXT_STATUS_DISCOUNT_LONG).'>
									<img src="images/icons/information-balloon.png" alt="" />
									</span>'; ?>
								</td>
							</tr>
						</table>
						<table cellpadding="8" cellspacing="8" class="table_input" width="100%">
							<tr>
								<td valign="middle" width="150">
								    <b><?php echo TEXT_STATUS_OT_DISCOUNT_FLAG; ?></b>
								</td>
								<td valign="middle">
									<?php echo  TEXT_ZONE_YES .' '. draw_radio_field_installer('STATUS_OT_DISCOUNT_FLAG2', '1'); ?>
	                      			<?php echo  TEXT_ZONE_NO .' '. draw_radio_field_installer('STATUS_OT_DISCOUNT_FLAG2', '0', 'true'); ?>
									<?php echo ' <span'.mouseOverJS('',TEXT_STATUS_OT_DISCOUNT_FLAG_LONG).'>
									<img src="images/icons/information-balloon.png" alt="" />
									</span>'; ?>
								</td>
							</tr>
						</table>
						<table cellpadding="8" cellspacing="8" class="table_input" width="100%">
							<tr>
								<td valign="middle" width="150">
								    <b><?php echo TEXT_STATUS_OT_DISCOUNT; ?></b>
								</td>
								<td valign="middle">
									<?php echo draw_input_field_installer('STATUS_OT_DISCOUNT2','0.00');?>
									<?php echo ' <span'.mouseOverJS('',TEXT_STATUS_OT_DISCOUNT_LONG).'>
									<img src="images/icons/information-balloon.png" alt="" />
									</span>'; ?>
								</td>
							</tr>
						</table>
	                    <table cellpadding="8" cellspacing="8" class="table_input" width="100%">
	                    	<tr>
	                    		<td valign="middle" width="150">
	                    		    <b><?php echo TEXT_STATUS_GRADUATED_PRICE; ?></b>
	                    		</td>
	                    		<td valign="middle">
	                    			<?php echo  TEXT_ZONE_YES .' '. draw_radio_field_installer('STATUS_GRADUATED_PRICE2', '1', 'true'); ?>
	                      			<?php echo  TEXT_ZONE_NO .' '. draw_radio_field_installer('STATUS_GRADUATED_PRICE2', '0'); ?>
	                    			<?php echo ' <span'.mouseOverJS('',TEXT_STATUS_GRADUATED_PRICE_LONG).'>
	                    			<img src="images/icons/information-balloon.png" alt="" />
	                    			</span>'; ?>
	                    		</td>
	                    	</tr>
	                    </table>
	                    <table cellpadding="8" cellspacing="8" class="table_input" width="100%">
	                    	<tr>
	                    		<td valign="middle" width="150">
	                    		    <b><?php echo TEXT_STATUS_SHOW_PRICE; ?></b>
	                    		</td>
	                    		<td valign="middle">
	                    			<?php echo  TEXT_ZONE_YES .' '. draw_radio_field_installer('STATUS_SHOW_PRICE2', '1', 'true'); ?>
	                      			<?php echo  TEXT_ZONE_NO .' '. draw_radio_field_installer('STATUS_SHOW_PRICE2', '0'); ?>
	                    			<?php echo ' <span'.mouseOverJS('',TEXT_STATUS_SHOW_PRICE_LONG).'>
	                    			<img src="images/icons/information-balloon.png" alt="" />
	                    			</span>'; ?>
	                    		</td>
	                    	</tr>
	                    </table>
	                    <table cellpadding="8" cellspacing="8" class="table_input" width="100%">
	                     	<tr>
	                     		<td valign="middle" width="150">
	                     		    <b><?php echo TEXT_STATUS_SHOW_TAX; ?></b>
	                     		</td>
	                     		<td valign="middle">
	                     			<?php echo  TEXT_ZONE_YES .' '. draw_radio_field_installer('STATUS_SHOW_TAX2', '1', 'true'); ?>
	                      			<?php echo  TEXT_ZONE_NO .' '. draw_radio_field_installer('STATUS_SHOW_TAX2', '0'); ?>
	                     			<?php echo ' <span'.mouseOverJS('',TEXT_STATUS_SHOW_TAX_LONG).'>
	                     			<img src="images/icons/information-balloon.png" alt="" />
	                     			</span>'; ?>
	                     		</td>
	                     	</tr>
						</table>
	
						<h2 class="schatten">
							<?php echo TITLE_MERCHANT_CONFIG; ?>
							<?php echo ' <span'.mouseOverJS('',TITLE_MERCHANT_CONFIG_NOTE,'','200').'>
								<img src="images/icons/information-balloon.png" alt="" />
							</span>'; ?>
						</h2>
						<table cellpadding="8" cellspacing="8" class="table_input" width="100%">
							<tr>
								<td valign="middle" width="150">
								    <b><?php echo TEXT_STATUS_DISCOUNT; ?></b>
								</td>
								<td valign="middle">
									<?php echo draw_input_field_installer('STATUS_DISCOUNT3','0.00');?>
									<?php echo ' <span'.mouseOverJS('',TEXT_STATUS_DISCOUNT_LONG).'>
									<img src="images/icons/information-balloon.png" alt="" />
									</span>'; ?>
								</td>
							</tr>
						</table>
						<table cellpadding="8" cellspacing="8" class="table_input" width="100%">
							<tr>
								<td valign="middle" width="150">
								    <b><?php echo TEXT_STATUS_OT_DISCOUNT_FLAG; ?></b>
								</td>
								<td valign="middle">
									<?php echo  TEXT_ZONE_YES .' '. draw_radio_field_installer('STATUS_OT_DISCOUNT_FLAG3', '1', 'true'); ?>
	                      			<?php echo  TEXT_ZONE_NO .' '. draw_radio_field_installer('STATUS_OT_DISCOUNT_FLAG3', '0'); ?>
									<?php echo ' <span'.mouseOverJS('',TEXT_STATUS_OT_DISCOUNT_FLAG_LONG).'>
									<img src="images/icons/information-balloon.png" alt="" />
									</span>'; ?>
								</td>
							</tr>
						</table>
						<table cellpadding="8" cellspacing="8" class="table_input" width="100%">
							<tr>
								<td valign="middle" width="150">
								    <b><?php echo TEXT_STATUS_OT_DISCOUNT; ?></b>
								</td>
								<td valign="middle">
									<?php echo draw_input_field_installer('STATUS_OT_DISCOUNT3','0.00');?>
									<?php echo ' <span'.mouseOverJS('',TEXT_STATUS_OT_DISCOUNT_LONG).'>
									<img src="images/icons/information-balloon.png" alt="" />
									</span>'; ?>
								</td>
							</tr>
						</table>
	                    <table cellpadding="8" cellspacing="8" class="table_input" width="100%">
	                    	<tr>
	                    		<td valign="middle" width="150">
	                    		    <b><?php echo TEXT_STATUS_GRADUATED_PRICE; ?></b>
	                    		</td>
	                    		<td valign="middle">
	                    			<?php echo  TEXT_ZONE_YES .' '. draw_radio_field_installer('STATUS_GRADUATED_PRICE3', '1', 'true'); ?>
	                      			<?php echo  TEXT_ZONE_NO .' '. draw_radio_field_installer('STATUS_GRADUATED_PRICE3', '0'); ?>
	                    			<?php echo ' <span'.mouseOverJS('',TEXT_STATUS_GRADUATED_PRICE_LONG).'>
	                    			<img src="images/icons/information-balloon.png" alt="" />
	                    			</span>'; ?>
	                    		</td>
	                    	</tr>
	                    </table>
	                    <table cellpadding="8" cellspacing="8" class="table_input" width="100%">
	                    	<tr>
	                    		<td valign="middle" width="150">
	                    		    <b><?php echo TEXT_STATUS_SHOW_PRICE; ?></b>
	                    		</td>
	                    		<td valign="middle">
	                    			<?php echo  TEXT_ZONE_YES .' '. draw_radio_field_installer('STATUS_SHOW_PRICE3', '1', 'true'); ?>
	                      			<?php echo  TEXT_ZONE_NO .' '. draw_radio_field_installer('STATUS_SHOW_PRICE3', '0'); ?>
	                    			<?php echo ' <span'.mouseOverJS('',TEXT_STATUS_SHOW_PRICE_LONG).'>
	                    			<img src="images/icons/information-balloon.png" alt="" />
	                    			</span>'; ?>
	                    		</td>
	                    	</tr>
	                    </table>
	                    <table cellpadding="8" cellspacing="8" class="table_input" width="100%">
	                     	<tr>
	                     		<td valign="middle" width="150">
	                     		    <b><?php echo TEXT_STATUS_SHOW_TAX; ?></b>
	                     		</td>
	                     		<td valign="middle">
	                     			<?php echo  TEXT_ZONE_YES .' '. draw_radio_field_installer('STATUS_SHOW_TAX3', '1'); ?>
	                      			<?php echo  TEXT_ZONE_NO .' '. draw_radio_field_installer('STATUS_SHOW_TAX3', '0', 'true'); ?>
	                     			<?php echo ' <span'.mouseOverJS('',TEXT_STATUS_SHOW_TAX_LONG).'>
	                     			<img src="images/icons/information-balloon.png" alt="" />
	                     			</span>'; ?>
	                     		</td>
	                     	</tr>
						</table>
						<table cellpadding="8" cellspacing="8" width="100%">
							<tr>
								<td valign="middle" align="center">
								    <input name="image" type="submit" class="button" value="Installation abschliessen" />
								</td>
							</tr>
						</table>
					</form>
				</td>
			</tr>
		</table>
	</div>
</div>
<?php
	include('includes/footer.php');
?>
</body>
</html>